package aliyun.cx.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import aliyun.cx.admin.entity.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CategoryMapper extends BaseMapper<Category> {
    
    /**
     * 统计使用指定分类的文章数量
     */
    @Select("SELECT COUNT(*) FROM article WHERE category_id = #{categoryId}")
    int countArticlesByCategoryId(Long categoryId);
}
